function checkUsername(str){
	 if(str==""){
	 document.getElementById("checkUsername").innerHTML="用户名不能为空"
	 }
	else 
		checkUser(str);
}
function loginCheckUsername(str){
	 if(str==""){
		 document.getElementById("checkUsername").innerHTML="用户名不能为空"
		 }
		else 
			document.getElementById("checkUsername").innerHTML=""
}
function checkUser(str){
	var user = {
            /*username: $("#username").val(),*/
			username:str,
        };
	$.ajax({
		cache:false,
		type:'post',
		url:"checkUsername.spring",
		contentType:'application/json;charset=utf-8', 
		traditional:true,
		dataType:"JSON",
		data: JSON.stringify(user),
		success:function(data){
			if(data==1)
				document.getElementById("checkUsername").innerHTML="用户名已被注册";
			else
				document.getElementById("checkUsername").innerHTML=""
		},	
		error:function(data, XMLHttpRequest, textStatus, errorThrown){  
			alert(0);
			}  
			       
	}) 
}
function checkPassword(str){
	 if(str==""){
	 document.getElementById("checkPassword").innerHTML="密码不能为空"
	 }
	else 
	document.getElementById("checkPassword").innerHTML=""
}
function confirmPassword(str){
	 s = document.getElementById("password").value;
	if(str !=s ){
		 document.getElementById("confirmPassword").innerHTML="两次密码不一致"
		 }
		else 
		document.getElementById("confirmPassword").innerHTML=""
		
}



function checkCode(str){
	 if(str==""){
	 document.getElementById("checkCode").innerHTML="验证码不能为空"
	 }
	else 
	document.getElementById("checkCode").innerHTML=""
}
function updateImgCode(){
	document.getElementById("CreateCheckCode").src="PictureCheckCode"  + "?nocache=" + new Date().getTime();  ;
}